// eslint-disable-next-line @typescript-eslint/no-var-requires
const envData = require('./config/env/index')

export default {
  /*
  ** Nuxt rendering mode
  ** See https://nuxtjs.org/api/configuration-mode
  */
  mode: 'universal',
  /*
  ** Nuxt target
  ** See https://nuxtjs.org/api/configuration-target
  */
  target: 'server',
  /*
  ** 页眉
  */
  head: {
    title: '一曲终了、只余一声空叹',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      {
        name: 'description',
        content:
          '个人的学习网站，主要放一些个人资料，学习笔记等。希望大家能一起学习交流'
      },
      { name: 'keywords', content: '王亚彬,王武岗,iOS,Node.js,前端,小程序' }
    ],
    link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }]
  },
  /**
   * 定义应用客户端和服务端的环境变量。
   */
  env: envData,
  /*
   ** 自定义进度条颜色
   */
  loading: {
    color: '#d6f4d7',
    duration: 100000,
    continuous: true
  },
  /*
  ** Global CSS
  */
  css: [
    'ant-design-vue/dist/antd.css',
    '@/assets/css/main.less'
  ],
  /*
  ** 安装应用程序前加载的插件
  */
  plugins: [
    '@/plugins/ant-design-vue',
    // 加载axios插件
    '@/plugins/axios',
    // 懒加载
    '@/plugins/lazy-load',
    // 自定义插件
    '@/plugins/myPlugin',
    // 粘贴板
    '@/plugins/vue-clipboard2',
    // svg
    '@/plugins/svg-icon',
    // 全局组件
    '@/plugins/globalComponents',
    // 路由
    { src: '@/plugins/router', ssr: false },
    // 百度统计
    { src: '@/plugins/baidu', ssr: false },
    // 权限
    { src: '@/plugins/auth', ssr: false }
  ],
  /*
  ** Auto import components
  ** See https://nuxtjs.org/api/configuration-components
  */
  components: true,
  /*
  ** Nuxt.js dev-modules
  */
  buildModules: [
    '@nuxt/typescript-build'
  ],
  /*
  ** Nuxt.js modules
  */
  modules: [
    '@nuxtjs/axios',
    '@nuxtjs/pwa',
    '@nuxtjs/sentry'
  ],
  /**
   * axios配置
   */
  axios: {
    timeout: 60000,
    proxy: true,
    baseURL: `/${envData.API_HEADER}`,
    browserBaseURL: `/${envData.API_HEADER}`
  },
  proxy: {
    '/webnuxt-api/': '/'
  },
  /**
   * 打包配置
   */
  build: {
    // 可以在这里扩展webpack配置
    publicPath: 'https://cdn.wangyabin.top/YBWeb/view/web_nuxt/client/'
  },
  /**
   * 服务器配置
   */
  server: {
    port: 3100 // default: 3000
  },
  /**
   * 路由
   */
  router: {
    middleware: 'auth'
  },
  sentry: {
    dsn: envData.SENTRY_DSN, // Enter your project's DSN here
    config: {
      environment: process.env.NODE_ENV
    }
  }
}
